class example{
private:
int val1=10;
int val2=15;
public:
example() {}
example(int& val1=0, int& val2=0): val1(val1), val2(val2) {}
example(const example& Lval): val1(Lval.val1), val2(Lval.val2) {}
example(example&& Rval): val1(Rval.val1), val2(Rval.val2) {}
example& operator=(const example& Lval){
val1=Lval.val1;
val2=Lval.val2;
return *this;
}
example& operator=(example&& Rval){
std::swap(val1, Rval.val1);
std::swap(val2, Rval.val2);
return *this;
}
~example() {}
};
int main(void){
inline example f(int val1, int val2){
example exam1(val1, val2);
return exam1;
}
example instance1;
example instance2(instance1);
example instance3(f(val1, val2));
example instance4=instance(10, 15);
example instance5=f(1, 5);
instance1.~example();
return 0;
}